import java.util.ArrayList;
import java.util.Random;


public class Level {
	
	private ArrayList<Objects> objects = new ArrayList<Objects>();
	/*
	 * tiles is a 2d array of the current state of each tile on this level
	 * Tile states:
	 * 0 - Wall
	 * 1 - Empty space
	 */
	private int[][] tiles;
	private byte levelNumber;
	private int roomXSize, roomYSize;
	
	Level(byte levelNumber, int roomXSize, int roomYSize){
		this.roomXSize = roomXSize;
		this.roomYSize = roomYSize;
		this.levelNumber = levelNumber;
		this.tiles = new int[this.roomXSize][this.roomYSize]; //int is initialised full of 0s
		generateRooms();
	}

	private void generateRooms() {
		Random randGen = new Random();
		int numberOfRooms = randGen.nextInt(4);
		for (int i = 0; i <= numberOfRooms; i++){
			/*
			 * take 18 from random number range and add one to generated
			 * number to keep room one tile from edge of map
			 */
			int xStartOfRoom = randGen.nextInt(this.roomXSize - 18) + 1 ;
			int yStartOfRoom = randGen.nextInt(this.roomYSize - 18) + 1 ;
			/*
			 * make xEndOfRoom a point 
			 */
			int xEndOfRoom = randGen.nextInt(16) + xStartOfRoom;
			int yEndOfRoom = randGen.nextInt(16) + yStartOfRoom;
			for (int x = xStartOfRoom; x <= xEndOfRoom; x++){
				for (int y = yStartOfRoom; y <= yEndOfRoom; y++){
					tiles[x][y] = 1;
				}
			}
		}
	}
}
